'\" e
'\"! eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 6 March 1997
.ds Re Release 1.2.0
.ds Dp May 02 11:53
.ds Dm 37 unproject
.ds Xs 63442 4 unproject.gl
.TH GLUUNPROJECT 3G
.SH NAME
.B "gluUnProject
\- map window coordinates to object coordinates

.SH C SPECIFICATION
GLint \f3gluUnProject\fP(
GLdouble \fIwinX\fP,
.nf
.ta \w'\f3GLint \fPgluUnProject( 'u
	GLdouble \fIwinY\fP,
	GLdouble \fIwinZ\fP,
	const GLdouble \fI*model\fP,
	const GLdouble \fI*proj\fP,
	const GLint \fI*view\fP,
	GLdouble* \fIobjX\fP,
	GLdouble* \fIobjY\fP,
	GLdouble* \fIobjZ\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\f2winX\fP\ \f2winY\fP\ \f2winZ\fP\ \ 'u 
\f2winX\fP, \f2winY\fP, \f2winZ\fP
Specify the window coordinates to be mapped.
.TP
\f2model\fP
Specifies the modelview matrix (as from a \f3glGetDoublev\fP call).
.TP
\f2proj\fP
Specifies the projection matrix (as from a \f3glGetDoublev\fP call).
.TP
\f2view\fP
Specifies the viewport (as from a \f3glGetIntegerv\fP call).
.TP
\f2objX\fP, \f2objY\fP, \f2objZ\fP
Returns the computed object coordinates.
.SH DESCRIPTION
\%\f3gluUnProject\fP maps the specified window coordinates into object 
coordinates using \f2model\fP, \f2proj\fP, and \f2view\fP.
The result is stored in \f2objX\fP, \f2objY\fP, and \f2objZ\fP. A return value of 
\%\f3GL_TRUE\fP indicates success; a return value of \%\f3GL_FALSE\fP
indicates failure.
.P
To compute the coordinates (\f2objX\fP, \f2objY\fP, and \f2objZ\fP),
\%\f3gluUnProject\fP multiplies the normalized device coordinates by the inverse of
\f2model\fP*\f2proj\fP as follows:

.P
.ce
.EQ
left ( down 70 {cpile { ~"objX" above ~"objY" above ~"objZ"
above ~W}} ~~ right ) ~=~ INV(P M) 
left ( down 140 {cpile { 
{ {2("winX" ~-~ "view"[0])} over {"view" [2]} ~-~ 1 }
above 
{ {2("winY" ~-~ "view"[1])} over {"view"[3]} ~-~ 1 }
above 
{ 2("winZ") ~-~ 1 }
above 
1}} ~~ right )
.EN
.bp
$INV()$ denotes matrix inversion. 
W is an unused variable, included for consistent matrix notation.
.SH SEE ALSO
\f3glGet(3G)\fP, \%\f3gluProject(3G)\fP
